#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@File   : demo1.py
@Time : 2025/1/10 16:13
@Author: Wangwc
@Describe:  ……
"""
dict = {"a": 1, "b": 2, "c": 3}

app_names = ["com.ugreen.help_server", "com.ugreen.pro.app", "com.com.ugreen.search_serv.search"]
result = {'com.ugreen.help_server': {'list': None, 'total': 0}, 'com.ugreen.pro.app': {'list': [{'accessCtrl': {'accessType': 0, 'gateWayAppAccesses': None, 'isAuthRequired': False, 'jumpInfo': None, 'supports': None, 'urlAppAccesses': None}, 'accessList': ['admin'], 'aloneModule': True, 'appId': 'com.ugreen.appmgr', 'appType': 0, 'arch': 'amd64', 'beDependList': None, 'category': 'category.system.manage', 'daemon': True, 'dependList': None, 'downloads': 0, 'exception': False, 'exceptionReason': 0, 'hash': '', 'i18n': [{'appHelpManualLink': '', 'appHelpManualTitle': '', 'author': 'UGREEN', 'containerInstallManualLink': '', 'description': 'App Center is an app management platform of UGREEN NAS.', 'help': '', 'langName': 'en-US', 'name': 'App Center', 'official': 'https://www.ugnas.com/', 'protocol': '', 'releaseNote': '', 'slogan': '', 'tags': ['System Management'], 'thumbs': None, 'thumbs_app': None}], 'icon': '/ugreen/static/icons/appmgr.png', 'iconModifyTimeSec': 1736131722, 'install': 1, 'installExclusive': False, 'installParameters': {'list': None, 'msg': None, 'version': 0}, 'installPath': '/ugreen/@appstore', 'installation_time': 0, 'isDockerApp': False, 'isNew': False, 'isRunning': True, 'languageList': ['en-US', 'zh-CN', 'de-DE', 'ja-JP'], 'localInstallParameters': {'list': None, 'msg': None, 'version': 0}, 'localVersion': {'beta': False, 'buildTime': 1735743177, 'gray': False, 'importantVersion': 0, 'lowVersion': '1.0.0.0000', 'models': ['DXP2800', 'DXP4800', 'DXP480T Plus', 'DXP4800 Plus', 'DXP6800 Plus', 'DXP6800 Pro', 'DXP8800', 'DXP8800 Plus', 'DXP8800 Pro', 'DX4700', 'DX4700+', 'DH2600', 'DX4600', 'DX4600+', 'DX4600 Pro', 'iDX6011', 'iDX6012'], 'recommend': False, 'size': 0, 'version': '1.1.3.2009', 'versionNum': 101032009}, 'managerType': 0, 'open_path': False, 'pkgType': 'ugb', 'recommendedForGettingStarted': 0, 'removeAble': False, 'repairCode': 0, 'route': '/appmgr', 'serviceName': 'app_serv.service', 'url': '', 'version': {'beta': False, 'buildTime': 1735743177, 'gray': False, 'importantVersion': 0, 'lowVersion': '1.0.0.0000', 'models': [], 'recommend': False, 'size': 0, 'version': '1.1.3.2009', 'versionNum': 101032009}}], 'total': 1}, 'com.ugreen.search_serv.search': {'file_arr': None, 'file_class_arr': None, 'is_last_page': False, 'total_num': 0}}


def demo1(apps,results):
    total_count = 0
    for app_name in apps:
        if app_name in results:
            b = results[app_name].get('total', 0)
            total_count += b
    return total_count

if __name__ == "__main__":
    a = demo1(app_names,result)
    print(a)
